﻿<?php

/***************************************************************
**                Linux Vod@home Streaming Server             ** 
****************************************************************

   Written by Nicolas VOISIN Aka DaNifty


****************************************************************/

error_reporting('E_ALL');
ini_set('display_errors',true);

// Ici, nous paramétrons le language pour l'interface HTML
include('lang/FR.inc.php');
date_default_timezone_set('Europe/Paris');


/*
	Paramètres du client
*/

$param['flash']['width'] = '100%';                    // Largeur du lecteur flash 
$param['compressor']['audiobitrate'] = "128k";   // Taux d'échantillonage AUDIO
$param['compressor']['videobitrate'] = "1024k"; // Taux d'échantillonage VIDEO

$sources=array
(
	"Videos sur WebServer"=>"/media/Videos/__FILMS__/"
	,"Videos sur XP001"=>"/media/FILMS_sur_LEFILOU-XP001/"
	,"Videos sur XP002"=>"/media/FILMS_sur_LEFILOU-XP002/"
);

define("flvplayer_buffer_length",30);


$allow_ext=array('avi','mpg','mpeg','mov','flv','wmv','mp3');

function directoryToArray($directory, $recursive) {
	global $allowed_ext;
	$array_items = array();
	if ($handle = opendir($directory)) {
		while (false !== ($file = readdir($handle))) {
			if ($file != "." && $file != "..") {
				if (is_dir($directory. "/" . $file)) {
					if($recursive) {
						$array_items = array_merge($array_items, directoryToArray($directory. "/" . $file, $recursive));
					}
					$file = $directory . "/" . $file;
					//$array_items[] = preg_replace("/\/\//si", "/", $file);
				} else {
					$file = $directory . "/" . $file;
					$r=pathinfo($file);
					$ext=$r['extension'];
					if (
						$ext=="wmv" || 
						$ext=="mpeg" || 
						$ext=="mpg" || 
						$ext=="avi" || 
						$ext=="flv" || 
						$ext=="mp3"
					) {
					// if (in_array($ext, $allowed_ext)) {

						$array_items[] = str_replace("/'","\\'",preg_replace("/\/\//si", "/", $file));
					}
				}
			}
		}
		closedir($handle);
	}
	return $array_items;
}

 
function getFileFromIndex($index)
{
        $list = listFiles();
        return ($list[$index]);
}

function CleanFileName($val)
{
return $val;
   $val = strtolower($val);

$val = ereg_replace(".mpeg", "", $val);
$val = ereg_replace(".flv", "", $val);
$val = ereg_replace(".wmv", "", $val);
$val = ereg_replace(".mov", "", $val);
$val = str_replace(".avi", "", $val);

   $val = str_replace("divx", "", $val);
   $val = str_replace("xvid", "", $val);
   $val = str_replace("dvdripp", "", $val);
   $val = str_replace("dvdrip", "", $val);
   $val = str_replace("dvdscr", "", $val);
   $val = str_replace("french", "", $val);
   
   $val = ereg_replace('19..','',$val);
   $val = ereg_replace('20..','',$val);
   
   $val = str_replace("-", " ", $val);
   $val = str_replace("_", " ", $val);
   $val = str_replace(".", " ", $val);

   $val = str_replace("vostfr", "", $val);
   $val = str_replace("vost", "", $val);
   $val = str_replace("vo", "", $val);
   $val = str_replace("vf", "", $val);
   

   
   $val = str_replace("g0ldz", "", $val);
   $val = ereg_replace(" fr ", "", $val);
   $val = ereg_replace("\((.)?\)", "", $val);

	    
   
   
   
   //$val = htmlentities($val);
   return $val;
}

?>
